{% extends 'basic.html' %}
{% load static %}
{% block title %}添加模块{% endblock %}
{% block content %}
    <div class="row h4">
        {% comment %}表单的action值为空，表示提交数据时提交给当前url{% endcomment %}
        <form action="" method="post" class="form-inline">
            {% csrf_token %}
            <div class="form-group">
                <label>模块：</label>
                <input class="form-control" type="text" name="module">
            </div>
            <div class="form-group">
                <label>参数：</label>
                <input class="form-control" type="text" name="param">
            </div>
            <div class="form-group">
                <input class="btn btn-primary" type="submit" value="提 交">
            </div>
        </form>
        <hr>
        <table class="table table-bordered table-hover table-striped">
            <thead class="bg-primary">
                <tr>
                    <td>模块</td>
                    <td>参数</td>
                </tr>
            </thead>
            <tbody>
                {% for mod in modules %}
                    <tr>
                        <td>{{ mod.modulename }}</td>
                        <td>
                            <ul class="list-unstyled">
                                {% for arg in mod.argument_set.all %}
                                    <li>
                                        {{ arg.arg_text }}
                                        <a class="btn btn-primary btn-xs" href="{% url 'del_arg' arg.id %}">delete</a>
                                    </li>
                                {% endfor %}
                            </ul>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
{% endblock %}
